package com.itheima.manager;

import com.itheima.common.R;
import com.itheima.domain.HomeNewProduct;
import com.itheima.service.IHomeNewProductService;
import com.itheima.vo.PageBeanVo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;

@Component
public class SmsHomeNewProductManager {

    @DubboReference
    IHomeNewProductService homeNewProductService;


    public R findlistByPage(Integer pageNum, Integer pageSize, String productName, Integer recommendStatus) {

        PageBeanVo pageBeanVo = homeNewProductService.findlistByPage(pageNum, pageSize, productName, recommendStatus);

        return R.success(pageBeanVo);
    }

    //添加新品
    public R addNew(HomeNewProduct homeNewProduct) {
        homeNewProductService.addNew(homeNewProduct);
        return R.success(null);
    }

    //批量删除
    public R delete(Integer[] ids) {
        homeNewProductService.delete(ids);
        return R.success(null);
    }

    //更新
    public R update(Integer[] ids, Integer recommendStatus) {

        homeNewProductService.update(ids,recommendStatus);
        return R.success(null);
    }

    //排序
    public R sort(Integer id, Integer sort) {

        homeNewProductService.sort(id,sort);
        return R.success(null);
    }
}
